#write in 2019,6,2
#write by lizhuoying 

from sqlalchemy import create_engine,Column,Integer,String

from sqlalchemy.ext.declarative import declarative_base

DB_URI='mysql+pymysql://root@127.0.0.1:3306/test?charset=utf8'

engine=create_engine(DB_URI)

Base=declarative_base(engine)#元类编程，将对象转化成元类

class Person(Base):
    __tablename__='person'
    id=Column(Integer,primary_key=True,autoincrement=True)
    name=Column(String(20))
    password=Column(String(120))

Base.metadata.create_all()